<?php
namespace app\interactive\admin;

use app\admin\controller\Admin;
use app\common\builder\ZBuilder;

use app\interactive\model\User as UserModel;

class Index extends Admin{

    public function index(){
        $map = $this->getMap();

        $userData = UserModel::where($map)->order('id asc')->paginate();

        return ZBuilder::make('table')
        ->hideCheckbox()
        ->setTableName('user')
        ->addColumns([
            ['id','ID'],
            ['name','姓名'],
            ['userPhoneNum','手机号码'],
            ['integral','目前积分','number'],
            ['registerTime','注册时间','datetime'],
            ['loginTime','上次登录时间','datetime']
        ])
        ->setRowList($userData)
        ->setColumnWidth([
            'id'  => 50,
            'name' => 100,
        ])
        ->addTimeFilter('loginTime','','登录开始,登录结束')
        ->setSearch(['name'=>'姓名','userPhoneNum'=>'手机号码'])
        ->fetch();
    }
}